//- Copyright (C) 2023 Beijing Huaxia Chunsong Technology Co., Ltd. 
//- <https://www.chatopera.com>, Licensed under the Chunsong Public 
//- License, Version 1.0  (the "License"), https://docs.cskefu.com/licenses/v1.html
//- Unless required by applicable law or agreed to in writing, software
//- distributed under the License is distributed on an "AS IS" BASIS,
//- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//- See the License for the specific language governing permissions and
//- limitations under the License.
//- Copyright (C) 2018-Jun. 2023 Chatopera Inc, <https://www.chatopera.com>
//- Licensed under the Apache License, Version 2.0
//- http://www.apache.org/licenses/LICENSE-2.0
extends /apps/include/layout.pug
block content
    .layui-side.layui-bg-black
        .layui-side-scroll
            include /apps/setting/include/left.pug
    .layui-body
        .layui-side-scroll
            .row
                .col-lg-12
                    h1.site-h1(style='background-color:#FFFFFF;') #{advType.name} 广告位 (#{size(adTypeList)}) #{advType.description}
                        span(style='float:right;')
                            button.layui-btn.layui-btn-small.green(href='/setting/adv/add.html?adpos=' + advType.id, data-toggle='ajax', data-width='950', data-height='500', data-title='添加广告' + advType.description) 添加广告
                    .row(style='padding:5px;')
                        .col-lg-12
                            table.layui-table(lay-skin='line')
                                colgroup
                                    col(width='20%')
                                    col(width='10%')
                                    col(width='10%')
                                    col(width='54%')
                                    col(width='5%')
                                    col(width='1%')
                                    col
                                thead
                                    tr
                                        th 广告名称
                                        th 类型
                                        th 权重
                                        th 内容
                                        th(style='white-space:nowrap;', nowrap) 创建时间
                                        th(style='white-space:nowrap;', nowrap) 操作
                                tbody
                                    if size(adTypeList) > 0
                                        for ad in adTypeList
                                            tr
                                                td: a(title=ad.tiptext, href=ad.url, target="_blank")= ad.name
                                                if ad.adtype == "image"
                                                    td 图片
                                                else if ad.adtype == "text"
                                                    td 文本
                                                td= ad.weight
                                                if ad.adtype == "image"
                                                    td: img(src=ad.imgurl, class="ukefu-media-image" data-type="preview" style="max-width:100px;max-height:50px;")
                                                else if ad.adtype == "text"
                                                    td= ad.content
                                                td(style="white-space:nowrap;" nowrap="nowrap")= pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', ad.createtime)
                                                td(style="white-space:nowrap;" nowrap="nowrap")
                                                    a(href='/setting/adv/edit.html?id=' + ad.id + '&adpos=' + ad.adpos, data-toggle="ajax", data-width="950", data-height="500", data-title="编辑广告")
                                                        i(class="layui-icon") &#xe642;
                                                        span 编辑
                                                    a(href='/setting/adv/delete.html?id=' + ad.id + '&adpos=' + ad.adpos, style="margin-left:10px;", data-toggle="tip", data-title="请确认是否删除广告？")
                                                        i(class="layui-icon") &#x1006;
                                                        span 删除
                                    else
                                        tr: td(colspan="20" style="height:400px;")
                                            .ukefu-empty(style="background: none")
                                                i.layui-icon &#xe63a;
                                                div(style="") 还没有标签记录